<?php

#奶粉的铝膜罐内码
$opts = array(
    'ssl' => array(
        'verification_peer_name' => 'second.mytlmc.cn',
        'verify_peer' => false,
        'verify_peer_name' => false
    )
);
$code=(isset($_GET["code"]))?$_GET["code"]:"";
$geturl="https://myr.wissun.net/gnm.php?code=".$code;
$url = 'https://second.wissun.net/index.php/Home/Xklb/get_access_token?url='.$geturl;
$context = stream_context_create($opts);
$content = file_get_contents($url, false, $context);
$content=json_decode($content,true);
$timestamp=$content["data"]["timestamp"];
$noncestr=$content["data"]["noncestr"];
$signature=$content["data"]["signature"];

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <title>Hi,欢迎您的到来~</title>
</head>
<style>
    .bd{
        /*background:url('https://ayh.wissun.net/static/ayh/g2.jpg') no-repeat center top;*/
        background: #f5f5f5;
        background-size:cover;
        background-attachment:fixed;
        margin: 0px;
        padding:0px;
    }
    .btnpic{
        position: fixed;bottom: 100px;width: 100%;z-index: 99999;
    }
    .picbn{
        width: 85%;margin: 0 auto;height: 45px;
    }
    .picbn img{
        width: 100%;height: 100%;
    }
    .tobanner{
        width: 100%;
        
    }
    .tobanner img{
        width: 100%;
    }
    .ptitle{ display:flex; padding-left: 20px;margin-top: 20px;}
    
    .lefpnd{width:2px;height:25px;background:#ad7c36;}
    .tildda{padding-left:10px;}
    .threediv{ 
        margin-top:30px;
        display:flex;
        width: 90%;
        margin: 0 auto;
        margin-top: 57px;
    }
    .duttdn{ 
        width:33%; 
        text-align:center;
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 14px;
    }
    .duttdn img{ width:60%;margin:0 auto; }
    .duttdn span{ padding-top:12px; }
    .bottomdiv{ 
        background:#1B764A;
        color:#fff;
        text-align: center;
        width: 160px;
        height: 40px;
        line-height: 40px;
        border-radius: 20px;
        font-size: 14px;
        margin: 0 auto;
        margin-top: 60px;
        font-weight: bold;
        letter-spacing: 2px;
        position: absolute;
        left: calc(50% - 80px);
        bottom: 50px;
    }
</style>
<body class="bd">

<div class="tobanner">
    <img src="https://ayh.wissun.net/static/ayh/dqd/s4.jpg"  />
    <div class="ptitle">
        <span class="lefpnd"></span>
        <span class="tildda">福利三部曲</span>
    </div>
    <div class="threediv">
        <div class="duttdn">
            <img src="https://ayh.wissun.net/static/ayh/dqd/s3.png"  />
            <span>打开奶粉罐</span>
        </div>
        <div class="duttdn">
            <img src="https://ayh.wissun.net/static/ayh/dqd/s1.png"  />
            <span>撕开铝膜</span>
        </div>
        <div class="duttdn">
            <img src="https://ayh.wissun.net/static/ayh/dqd/s2.png"  />
            <span>扫码二维码</span>
        </div>
    </div>
    <!--<h4 style="text-align: center;-->
    <!--margin-top: 100px;font-size: 24px;">美优然罐内码</h4>-->
    <div class="width:160px;margin:0 auto;position:absolute:bottom:30px;display:none;"> 
    <wx-open-launch-weapp
          id="launch-btn"
          username="gh_6df720610b98"
          path="pages/saoysao/index"
        >
      <script type="text/wxtag-template">
           <div style="width:260px;text-align:center;margin:0 auto;">
               <div  style="background:#1B764A;
                    color:#fff;
                    text-align: center;
                    width: 54%;
                    height: 40px;
                    line-height: 40px;
                    border-radius: 20px;
                    font-size: 14px;
                    margin: 0 auto;
                    font-weight: bold;
                    letter-spacing: 2px;
                    margin-left:46%;
                    margin-top:120px;
                ">
                    <span>前往扫码界面</span>
                </div>
            </div>
    </script>
    </wx-open-launch-weapp>
    </div>
    
</div>


 

</body>
 <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> 
 <script type="text/javascript">
    wx.config({
        debug:false, // 是否开启调试模式
        appId:'wxa3f5611096809ecb', // 必填，公众号的唯一标识
        timestamp:'<?php echo $timestamp;?>', // 必填，生成签名的时间戳
        nonceStr: '<?php echo $noncestr;?>', // 必填，生成签名的随机串
        signature: '<?php echo $signature;?>',// 必填，签名
        jsApiList:['openLocation'], // 必填，需要使用的JS接口列表
        openTagList: ['wx-open-launch-weapp'] // 可选，需要使用的开放标签列表，例如['wx-open-launch-app']
    }); 
    
    wx.ready(function () {
      // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中
    });
    
    wx.error(function (res) {
      // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名
    });
    
    var btn = document.getElementById('launch-btn');
    btn.addEventListener('launch', function (e) {
        console.log('success');
    });
    btn.addEventListener('error', function (e) {
        console.log('fail', e.detail);
    });
</script>

</html>